package com.matrix.api.marketing.dto;

import jakarta.validation.constraints.DecimalMin;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author 有点甜
 * @since 2025/8/7
 */
@Data
public class MerchantCouponGrantRequestDTO implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @NotNull(message = "目标用户ID不能为空")
    private Long targetUserId;

    @NotBlank(message = "优惠券标题不能为空")
    @Size(max = 50, message = "标题不能超过50个字符")
    private String title;

    @NotNull(message = "优惠券类型不能为空")
    private CouponType couponType;

    @NotNull(message = "满减门槛不能为空")
    @DecimalMin(value = "0.00", message = "满减门槛不能为负")
    private BigDecimal thresholdAmount;

    @NotNull(message = "抵扣金额不能为空")
    @DecimalMin(value = "0.01", message = "抵扣金额必须大于0")
    private BigDecimal discountAmount;

    public enum CouponType {
        THRESHOLD,
        NO_THRESHOLD
    }
}
